public class TaxiMeter {
    private TaxiCharge nightCharge;
    private TaxiCharge dayTimeCharge;

    public TaxiMeter(TaxiCharge nightCharge, TaxiCharge dayTimeCharge) {
        this.nightCharge = nightCharge;
        this.dayTimeCharge = dayTimeCharge;
    }

    public TaxiCharge createTaxiCharge(int time) {
        if(isNight(time)) {
            return nightCharge;
        } else {
            return dayTimeCharge;
        }
    }

    private boolean isNight(int time) {
        return time < 6;
    }
}
